<?php
$form = new Form('users');

/* Change getElements to loadElements, less confusion */
$form->loadElements();

/* MySQLList class standardizes how to get an array of values from mysql */
$form->getElement('supervisor')->setOptions(
    new MySQLList('users', 'name', NULL, new MySQLConstraint("is_super = 'y'")));

/* Form element types should be defined with constants (if not subclasses) */    
$form->getElement('is_super')->setType(FORM_ELEMENT_RADIO);

/* A couple different ways to get things done */
$form->setLabels(array('field1' => 'Field 1', 'field2' => 'Field 2'));
$form->getElement('field1')->setLabel('Field 1');

/* A couple different ways to get things done */
$form->setRequired(array('field1', 'field2', 'field3'), false);
$form->getElement('field1')->setRequired(false);

/* Multiple classes of form rules to streamline rule processing  and make it extensible */
$form->addRule('field01', new RegexFormRule('regex', 'key'));

$form->addGroup(new FormElementGroup('name', 'Title', array('element1','element2','element2')));

/*

  Other Thoughts:
  
  - It'd be a lot cleaner if we could have different classes for the different form elements. But I
    am unsure how this would effect the process of changing a form from one type to another.
    (casting?)
  
  - Create a FormPage class that automatically attaches javascript and css files as needed. Also can
    automatically name the form page (if desired) based on the current operation (add/edit/delete).
  
  - Native support for versioning. This would make the main CS site implementation a lot easier.
  
  - Events. Ability to do hook in and run code at various stages of form submission.
  
  - A cleaner JavaScript API.

*/

?>